package com.longge.common.configuration;

import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;

@Configuration
@AutoConfigureAfter(JacksonAutoConfiguration.class)
public class JacksonLongTypeAutoConfiguration {
	
	@Bean
	public JacksonLongBootstrap jacksonLongBootstrap(ObjectMapper jacksonObjectMapper) {
		SimpleModule simpleModule = new SimpleModule();
		simpleModule.addSerializer(Long.class, ToStringSerializer.instance);
		jacksonObjectMapper.registerModule(simpleModule);
		return null;
	}
	
	static class JacksonLongBootstrap {
	}
}
